let changeBgImg =  function (hook) {
    hook.doneEach(function () {
    const backgroundImg = document.querySelector('#backgroundImg > img')
    let bgArr = [
        './backgroundImg/main-bg.png',
        // './backgroundImg/bg2.jpg'
    ]
    // console.log(backgroundImg.src=='')
    let index = 0
    // let position =['-100%,0','100%,0%']
  
    if(backgroundImg.src==''){
        backgroundImg.style.transform = 'translate(-100%)'
        setTimeout(()=>{
            backgroundImg.style.transform = 'translate(0)'
            backgroundImg.src = bgArr[0]
        }) 
    }
    // let timer = null
    // let flag = false
    //     setInterval(()=>{
    //         let random = Math.floor((Math.random()*(0+position.length+0)))
    //         // console.log(random)
    //         backgroundImg.style.transform = `translate(${position[random]})`
    //         timer = setTimeout(()=>{
    //             backgroundImg.style.transform = 'translate(0)'
    //             backgroundImg.src = bgArr[index]
    //             flag = true
    //         },500)
    //         flag = false
    //         index++
    //         if(index>bgArr.length-1){
    //             index = 0
    //         }
    //     },5000)
    //     if(flag){
    //         clearTimeout(timer)
    //     }
      
    });
  }